package com.bgds.sys.util;

import cn.hutool.core.io.file.FileWriter;
import com.bgds.sys.common.utils.ByteUtil;
import com.bgds.sys.common.utils.HexUtil;
import com.sun.org.apache.bcel.internal.generic.GOTO;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.function.Consumer;

/**
 * @author chenchao
 * @date 2021/10/22
 */
public class DianwenData {
    //private static final String DATA_PATH="C:\\Users\\Administrator\\Desktop\\logs\\dianwendata.txt";
    private static final String DATA_PATH = "/home/bs/logs/dianwendata.txt";


    public static void appendMessage(String msg, byte[] bytes) {
        FileWriter writer = new FileWriter(DATA_PATH);
        writer.append("\r\n");
        writer.append(msg);
        writer.append("\r\n");
        writer.append(HexUtil.encode(bytes));
        writer.append("\r\n");
        writer.append("-------------------------------------------------------------------------------------------");

    }

    public static void main(String[] args) {
       StringBuilder str=new StringBuilder();
       str.append("323331363030313030313230323131313137313431343130303039394400000000000000000000000000000000000000000000000001010000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b1000000010000000000000000000101010101010101000000000100000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d11e0300ec29030068430f0089630e00bd852500c5642500f5890d0055900f0035d90d0098ab0f008ce10e00ccc10e005c7c0200d879020085d90500b5ac0400000000000000000000000000000000000000000085f40c0005f50c00409e0c006cfe01000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078b8060002d006002d810300a7b206001bb50600c1710300de8b0100a4810100fd77040025770400ac140000c6c6ff003c96ff00749bff00bcfdff017102000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003fc20000d7080000000000000000000000000000ca420700a61d7c0197c8010000000000de080000ce0300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000889174a009d8349983eb94940615149e047d8480968d74b2035b7480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004210cccd4210666741e4000041dd999a42160000421c0000421b999a4214cccd4214000041e1999a41de6667421666674214666742173333424800004233999a42160000420c66674250000042446667424b33334239999a423ccccd421e6667421a00004274666742620000425c6667421a0000421a000041ef333341f800004228cccd4229333342273333421b3333421c000041df333341d1999a42086667420ccccd42066667000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000000000000000000da4b683c5f42db3ccdccb0416666ae41cdccb4413333b7413333b3410000d0416666da416666d2416666ea416666ea410000b8416666b2417b092d3c13dacb3b3333b3416666ae416666b6410000b8410000b0413333d3416666d6416666ce41cdcce8419a99e5410000b4416666ae41f6d21a40ed255b3f33331f42333327429a995742cdcc6a423333714233331742cdcc1e4233332d4233331d429a99e9410000424266662e42333377426666874266662042cdcc0a42d15ec23df612da3d0000d8413333db413333c341cdccc0410000c4419a99e1413333e341cdcce0419a99e9410000e8413333e341cdcce041cdcce4413333e3416666e6416666e64198d01f4025b4603f9a9925429a9921429a99534200005042cdcc6a42cdcc1a42cdcc324266662a429a991f42cdcce84133333d429a993f4266667242666676429a991f4233330942be84863d0000b03d3333db419a99dd410000c8419a99c941cdccc841cdcce0410000e441cdcce0413333eb416666ea419a99e541cdcce4416666e6413333e7410000e841cdcce841f7920c400100c63e00001e429a99214233336d42cdcc6e42000062423333194200001e4266663e42333325426666ea4133333d420000384233337342666680429a992142cdcc064200000000000000000000000000000000000000000000000000000000d882bd3d78777b3d04af504300000000558d40437c096d3c30714543000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042108800421d60e341f3938e41f93097425deed042698930426972f700000000420966130000000042767c000001000000000000000000000000000000000000000000000000ffff00009a992d42cdcc0a429a992b4200001a42cdcc1a42ffff0000000030429a99374267663c42cdcc164200001a42ffff000033333342cdcc304200003e42cdcc1842cdcc1e42ffff00009a9935429a9931423333314267662c429a992f42ffff0000000030429a99374267663c42cdcc164200001a42ffff000033333342cdcc304200003e42cdcc1842cdcc1e42ffff00009a9935429a9931423333314267662c429a992f42010000009a991f420000000000000000000000000000204200000000000000000000000000001a420000000000000000000000000000000000000000010000009a991942000000000000000000000000333319420000000000000000000000003333194200000000000000000000000000000000000000000000000001000000666640420000000000000000000000009a994342000000000000000000000000cdcc424200000000000000000000000000000000000000000100000033333d4200000000000000000000000033333f420000000000000000000000009a993d4200000000000000000000000000000000000000000000000000");
        byte[] bytes= HexUtil.decode(str.toString());
        ByteBuffer buffer=ByteBuffer.wrap(bytes);
        buffer.order(ByteOrder.LITTLE_ENDIAN);
        System.out.println(buffer.order(ByteOrder.BIG_ENDIAN).getFloat(987));
        System.out.println(buffer.order(ByteOrder.LITTLE_ENDIAN).getFloat(1357));

    }


}
